<?php

	/**
	 * Elgg custom profile 
	 * You can edit the layout of this page with your own layout and style. Whatever you put in the file
	 * will replace the frontpage of your Elgg site.
	 * 
	 * @package Elgg
	 */
	 
?>

<div id="custom_index">

    <!-- left column content -->
    <div id="index_left">
        
        
        <?php if (!isloggedin()){ ?>
        <div class="index_left_menu topleft_corner">
            
                    <h2><a href="<?php echo $vars['url']; ?>pg/socialcommerce/all">Browse Products</a></h2>
                        
        </div>
        <?php } ?>
        
        <?php if (isloggedin()){ ?>
        <div class="index_left_menu topleft_corner">
            
                    <?php
                        if (isloggedin()){
                                echo "<h2>" . elgg_echo("welcome") . " ";
                                echo $vars['user']->name;
                                echo "</h2>";
                        }
                ?>
                        
        </div>
        
        <?php } ?>
        
        <?php if (!isloggedin()){ ?>
        <!-- welcome message -->
        <div id="index_welcome"> 
     
            <?php
                //include a view that plugins can extend
                echo elgg_view("index/lefthandside");
            ?>
                <?php
                    //this displays some content when the user is logged out

                        //display the login form
                                echo $vars['area1'];
                                echo "<div class=\"clearfloat\"></div>";

                ?>
        </div>
        <?php } ?>
        
        <div id="advert_01">

        </div>
        
        <?php if (isloggedin()){ ?>
        <div class="index_left_menu">            
                    <h2><a href="<?php echo $vars['url']; ?>pg/socialcommerce/all">Browse Products</a></h2>                        
        </div>
        <?php } ?>
        
        <?php if (!isloggedin()){ ?>
        <div class="index_left_menu">
                    <h2>How it works</h2>
        </div>
        <?php } ?>
        
        <?php if (isloggedin()){ ?>
        <div class="index_left_menu">
                    <h2><a href="<?php echo $vars['url']; ?>pg/blog/owner/"<?php $vars['user']->name ?>>Blog with us!</a></h2>
        </div>
        <?php } ?>
        
        <?php if (!isloggedin()){ ?>
        <div class="index_left_menu">
                    <h2><a href="<?php echo $vars['url']; ?>pg/blog/all">Browse Blog</a></h2>
        </div>
        <?php } ?>
        
        <?php if (!isloggedin()){ ?>
        <div class="index_left_menu">
                    <h2><a href="<?php echo $vars['url']; ?>pg/groups/all">Groups</a></h2>
        </div>
        <?php } ?>
        
        <?php if (isloggedin()){ ?>
        <div class="index_left_menu">
                    <h2><a href="<?php echo $vars['url']; ?>pg/groups/member/"<?php $vars['user']->name ?>>My Groups</a></h2>
        </div>
        <?php } ?>


    </div>
    

    <div class="index_centre">
    
        <div id="index_middle">
                <div style="margin: 0 0 20px;">
                    <h1 style="font-size:3em; font-weight: normal;">What We Do</h1>
                    <h3>..helping you find nutritional, traceable, local food, <i>locally</i></h3>
                </div>
                <!--
                <div style="margin: 0 -11px 10px -11px;">
                    <img src="<?php //echo $vars['url']; ?>mod/cloudy_premium/graphics/country_fields.png" border="0" width="100%" />
                </div>-->
                <div id="middle_left">
        		<ul id="customlist">
        			<li><b>For Businesses</b></li>
        			<li id="green">Advertise yourself for free!</li>
        			<li id="brown">Upload your products for free! The more you upload, the more likely you are to be found..</li>
        			<li id="lightorange">Promote your latest deals for free!</li>
        			<li id="orange">Like to blog? Tell us about your food, how its produced, how its processed, where its from..</li>
        			<li id="red">Get found by customers looking for local food in your area. For free!</li>
        		</ul>	
        	</div>
        	<div id="middle_right">
        		<ul id="customlist">
        			<li><b>For Consumers</b></li>
        			<li id="green">Interested in local food? Then come search with us! (coming soon)</li>        			
        			<li id="brown">Interested in knowing where your food comes from? We've got that too..</li>
        			<li id="lightorange">Like to blog about food? Blog and share to your hearts content!</li>
        			<li id="orange">Is recipes/diets your thing? Share them with us and help people find nutritional food locally (coming soon).</li>       
        			<li id="red">Social networking? We've got it covered! Make friends, connect, share your passion for food with others!</li> 			        			        			
        		</ul>
        	</div>
        </div>
        
        

        <div style="clear: both;">
            <!-- more content -->
            <!-- latest members -->
            <div class="index_box">
                <h2><?php echo elgg_echo("custom:members"); ?></h2>
                <div class="contentWrapper">
                    <?php 
                    if(isset($vars['area2'])) {
                        //display member avatars
                        foreach($vars['area2'] as $members){
                            echo "<div class=\"index_members\">";
                            echo elgg_view("profile/icon",array('entity' => $members, 'size' => 'small'));
                            echo "</div>";
                        }
                    }
                    ?>
                    <div class="clearfloat"></div>
                </div>
            </div>


        </div>
        
        
        
        
    <!-- 
       <object style="height: 280px; width: 640px">
       
           <param name="movie" value="http://www.youtube.com/v/8dCIzlLEhes?version=3&feature=player_detailpage&autohide=1&showinfo=0&modestbranding=1&rel=0">
           <param name="allowFullScreen" value="true">
           <param name="allowScriptAccess" value="always">
           <embed src="http://www.youtube.com/v/8dCIzlLEhes?version=3&feature=player_detailpage&autohide=1&showinfo=0&modestbranding=1&rel=0" 
                  type="application/x-shockwave-flash" allowfullscreen="true" 
                  allowScriptAccess="always" width="462" height="259">
       </object>   
       
        --> 
       
  
    
    <div class="index_box">
        <h2><?php echo elgg_echo("custom:groups"); ?></h2>
                <div class="contentWrapper">
                    <?php 
                    set_input('search_viewtype','list');
                    set_context('search');
                    
                    $content = elgg_list_entities(array(
                        'types' => 'group', 
                        'limit' => 5, 
                        'list_type_toggle' => FALSE,
                        'full_view' => FALSE, 
                        'pagination' => FALSE,
                        ));

                    echo $content;
  
                    ?>
                    <div class="clearfloat"></div>
                </div>    
    </div>
  </div>
    <!-- right hand column  - empty-->

    <div class="clearfloat"></div>
</div>